package com.cruise.h5.mapper;

import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.cruise.h5.pojo.entity.VideoComment;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Update;

/**
 * <p>
 *  Mapper 接口
 * </p>
 *
 * @author cruise
 * @since 2021-03-25
 */
@Mapper
public interface VideoCommentMapper extends BaseMapper<VideoComment> {

    /**
     * 评论数 +1
     * @param id
     */
    @Update("update b_video_comment set b_video_comment.reply_count = b_video_comment.reply_count  + 1 where b_video_comment.id =  #{id}")
    void addCommentCount(@Param("id") String id);


    /**
     * 点赞，点赞数 + 1
     * @param id
     */
    @Update("update b_video_comment set b_video_comment.like_count = b_video_comment.like_count  + 1 where b_video_comment.id =  #{id}")
    void like(@Param("id")String id);

    /**
     * 取消点赞，点赞数 - 1
     * @param id
     */
    @Update("update b_video_comment set b_video_comment.like_count = b_video_comment.like_count  - 1 where b_video_comment.id =  #{id}")
    void cancelLike(@Param("id")String id);

    /**
     * 点踩，点踩数 + 1
     * @param id
     */
    @Update("update b_video_comment set b_video_comment.dislike_count = b_video_comment.dislike_count  + 1 where b_video_comment.id =  #{id}")
    void disLike(@Param("id")String id);

    /**
     * 取消点踩，点踩数 - 1
     * @param id
     */
    @Update("update b_video_comment set b_video_comment.dislike_count = b_video_comment.dislike_count  - 1 where b_video_comment.id =  #{id}")
    void cancelDisLike(@Param("id")String id);
}
